-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat: Add option to add CSP to the replay iframe #1766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat: Add option to add CSP to the replay iframe #1766
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR attempts to add Content Security Policy (CSP) support to the replay iframe to allow users to tighten security by blocking images, videos, objects, iframes, and other content types.
Key Changes:
- Added optional
cspconfiguration parameter to theplayerConfigtype - Implemented CSP application logic in the
setupDommethod of the Replayer class
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/rrweb/src/types.ts | Adds optional csp?: string property to playerConfig type definition |
| packages/rrweb/src/replay/index.ts | Implements CSP application by setting the csp attribute on the replay iframe element |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
ec2a859 to
4016cb3
Compare
|
Hi @KristianGrafana, thanks for this addition. Since the csp attribute is lacking some major browser support it would be good to document this so people who use it don't get a false sense of security. And in general it would be good to document this feature in the Guide.md and rrweb-player readme files |
This PR adds support to add a Content-Security-Policy to the iframe. This is if users want to further tighten the security of the iframe by being able to block images, videos, objects, iframes and more.
Let me know if you have any questions!